/**axios封装
 * 请求拦截、相应拦截、错误统一处理
 */
 import axios from 'axios';

// 接口请求地址
axios.defaults.baseURL = 'http://localhost/phone/';

 // 请求超时时间
 axios.defaults.timeout = 10000;
 


 const api = axios.create({

 })

//请求拦截器
api.interceptors.request.use(
    request=>{
        const username = localStorage.getItem('username') || null
        // console.log("打印token",token);
        if(username!=null)
        {
            request.headers = {
                'content-Type': 'application/json;charset=utf-8',
                loginuser: encodeURIComponent(username)
              }
        }
        return request;
    }
)

  
export default api



